import type { PostRes, DisableDto, DisableRes, PostDto } from "~/rest";

import { Gateway, getGateway } from "@/droplet-bus/core.define";

import { Media } from "@/pond-media/schema.media";
import { RiverTonGateway } from "@/river-ton/core.define";
import { RefTonOrderMedia, RefTonOrderStamp, TonOrder } from "@/river-ton/schema.order";

/** 订单/图片 */
export const TonOrderMediaGateway: Gateway = getGateway(RiverTonGateway, "river_ton_order_media");
export type putTonOrderMediaDto = { orderId: TonOrder["uuid32"]; mediaId: Media["id"] };
export type deleteTonOrderMediaDto = DisableDto;
export interface TonOrderMediaInterfaceWithGrant<T> {
  put(dto: T & putTonOrderMediaDto): Promise<PostRes<RefTonOrderMedia>>;
  delete(dto: T & deleteTonOrderMediaDto): Promise<DisableRes>;
}

/** 订单/签名 */
export const TonOrderStampGateway: Gateway = getGateway(RiverTonGateway, "river_ton_order_stamp");
export type putTonOrderStampDto = PostDto<RefTonOrderStamp>;
export type deleteTonOrderStampDto = DisableDto;
export interface TonOrderStampInterfaceWithGrant<T> {
  put(dto: T & putTonOrderStampDto): Promise<PostRes<RefTonOrderStamp>>;
  delete(dto: T & deleteTonOrderStampDto): Promise<DisableRes>;
}
